package com.yangff.api.client;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yangff.api.client.fallback.ProductClientFallbackFactory;
import com.yangff.entity.product.entity.dto.FundnetvalueDTO;
import com.yangff.entity.product.entity.dto.ProductCommentsDTO;
import com.yangff.entity.product.entity.vo.FundnetvalueVo;
import com.yangff.entity.product.entity.vo.ProductCommentsVo;
import com.yangff.entity.product.entity.vo.ProductVo;
import com.yangff.entity.vo.ResultVo;
import com.yangff.entity.product.entity.Financialproduct;
import com.yangff.entity.product.entity.dto.AutoStockDTO;
import com.yangff.entity.product.entity.dto.FinancialproductDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@FeignClient(value = "product", fallbackFactory = ProductClientFallbackFactory.class)
public interface ProductClient {
    @PostMapping("/financialproduct")
    ProductVo saveProduct(@RequestBody Financialproduct financialproduct);

    @GetMapping("/financialproduct")
    Page<ProductVo> selectProduct(@PageableDefault Pageable pageable);


    //按照产品代码查询
    @GetMapping("/financialproduct/{code}")
    ProductVo getProductByCode(@PathVariable("code") String code);

    //按照产品代码删除
    @DeleteMapping("/financialproduct/{code}")
    ResultVo deleteProductByCode(@PathVariable("code") String code);

    //修改
    @PutMapping("/financialproduct")
    ProductVo updateProduct(@RequestBody FinancialproductDTO financialproductDTO);

    //按照类型随机生成产品
    @PostMapping("/financialproduct/type")
    ProductVo saveTypeProduct(@RequestBody AutoStockDTO stockDTO);

    //查一下
    @GetMapping("/fundnetvalue/{code}")
    List<FundnetvalueVo> getFundNetValueByCode(@PathVariable("code") String code);

    @PostMapping("/fundnetvalue")
    ProductVo saveFundNetValue(@RequestBody FundnetvalueDTO fundnetvalueDTO);

    @DeleteMapping("/fundnetvalue/{code}")
    ResultVo deleteFundNetValueByCode(@PathVariable("code") String code);

    @PostMapping("/fundnetvalue/update")
    ResultVo updateAllFundNetValue(@RequestBody ResultVo empty);

    @GetMapping("/product-comments/code/{code}")
    List<ProductCommentsVo> getProductCommentsByCode(@PathVariable("code") String code);

    @GetMapping("/product-comments/user/{account}")
    List<ProductCommentsVo> getProductCommentsByAccount(@PathVariable("account") String account);

    @PostMapping
    ResultVo addProductComments(@RequestBody ProductCommentsDTO productCommentsDTO);








    }
